package com.amsp.oa.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;

@Component
@Slf4j
public class StartupListener implements ApplicationListener<ApplicationStartedEvent> {

    @Override
    public void onApplicationEvent(ApplicationStartedEvent event) {
        String banner = "\n" +
                "    .---.  .-----------------. .---.     .---.\n" +
                "    |   |  |   Welcome to    | |   |     |   |\n" +
                "    |   |  |    OA Test      | |   |     |   |\n" +
                "    |   |  '-----------------' |   |     |   |\n" +
                "    |   |                     |   |     |   |\n" +
                "    |   |    .-^-.  .-^-.    |   |     |   |\n" +
                "    |   |   /  @  \\/  @  \\   |   |     |   |\n" +
                "    |   |   \\     /\\     /   |   |     |   |\n" +
                "    |   |    \\   /  \\   /    |   |     |   |\n" +
                "    |   |     \\ /    \\ /     |   |     |   |\n" +
                "    |   |    --+      +--    |   |     |   |\n" +
                "    |   |      |      |      |   |     |   |\n" +
                "    |   |      |  ||  |      |   |     |   |\n" +
                "    '---'      '--''--'      '---'     '---'\n" +
                "=================================================\n" +
                "=================================================\n" +
                "      ٩(◕‿◕｡)۶  启动成功!  ٩(◕‿◕｡)۶\n" +
                "=================================================";

        log.info(banner);
        log.info("应用启动成功! 服务已准备就绪 (●'◡'●)");
        log.info("==========================================================");
    }
}